# @Author   : 懒羊羊
# @File     : regpage.py
# @Time     : 2024/12/4 19:01
import time

from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By


# eFile = os.path.join(data_path, "ecshop.xlsx")
# zhuce = DoExcel().readExcelRowCol(eFile, "zhuce", 2, 2, 1, 5)


class RegPage():
    unameE = (By.CSS_SELECTOR, "input[name='username']")
    uemailE = (By.CSS_SELECTOR, "input[name='email']")
    upwdE = (By.CSS_SELECTOR, "input[name='password']")
    upwdE2 = (By.CSS_SELECTOR, "input[name='confirm_password']")
    uphoneE = (By.CSS_SELECTOR, "input[name='extend_field5']")
    usubmitE = (By.CSS_SELECTOR, "input[name='Submit']")

    def zhuCe(self, wd, username, email, password, confirm_password, phone):
        wd.get("http://192.168.88.102/user.php?act=register")
        wd.implicitly_wait(10)

        wd.find_element(*self.unameE).send_keys(username)
        wd.find_element(*self.uemailE).send_keys(email)
        wd.find_element(*self.upwdE).send_keys(password)
        wd.find_element(*self.upwdE2).send_keys(confirm_password)
        wd.find_element(*self.uphoneE).send_keys(phone)
        wd.find_element(*self.usubmitE).click()

        time.sleep(2)
        wd.quit()


if __name__ == '__main__':
    wd = webdriver.WebDriver()
    #     # 最大化窗口
    wd.maximize_window()
    rp = RegPage()
    rp.zhuCe(wd, "lbxx2", "987@qq.com", "123456", "123456", "98765432100")
